package Engine.TileHandling;

import java.awt.Color;
import java.awt.image.BufferedImage;

/**
 * Represents and specifies the properties of a tile.
 * @author Lueko
 *
 */
public class Tile {
	
    private TileGraphics tileGraphic;
    private int color;
    private int type;
    public static int SIZE = 32;
    
    public static Tile err = new Tile(new TileGraphics(32, 32, Color.DARK_GRAY), 0, false);
    
    /**
     * Creates a standard none solid tile.
     * @param tileGraphic Look of the tile.
     * @param color Pixel color on the map image for this tile.
     * @param addToTiles Add to tiles array to check if the tile is on the map.
     */
    public Tile(TileGraphics tileGraphic, int color, boolean addToTiles) {
        this.tileGraphic = tileGraphic;
        this.color = color;
        this.type = 0;
        
        if (addToTiles) TileRenderer.tiles.add(this);
    }
    
    /**
     * Creates a tile with a specific characteristic (solid or not, makes moving things slower, etc.)
     * @param tileGraphic Look of the tile.
     * @param color Pixel color on the map image for this tile.
     * @param addToTiles Add to tiles array to check if the tile is on the map.
     * @param type Specifies a specific characteristic. (0 = air, 1 = solid, 2 = slower movement?, ...)
     */
    public Tile(TileGraphics tileGraphic, int color, boolean addToTiles, int type) {
        this.tileGraphic = tileGraphic;
        this.color = color;
        this.type = type;
        
        if (addToTiles) TileRenderer.tiles.add(this);
    }
    
    public BufferedImage getTileImage() {
        return tileGraphic.image;
    }
    
    public int getColor() {
    	return color;
    }
    
    public int getType() {
    	return type;
    }
    
}
